package com.gongj.processor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class MyProcessor implements BeanPostProcessor {


	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		if("userService".equals(beanName)){
			System.out.println("初始化前 = " + beanName);
		}

		return null;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {

		if("userService".equals(beanName)){
			System.out.println("初始化后" + beanName);
		}
		return null;
	}
}
